package com.yanqu.road.entity.activity.langyabang.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.langyabang.entity.LangYaValueByRank;
import com.yanqu.road.entity.config.system.NormalWeightItem;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class LangYaBangConfig {
    //activityInfo
    private ActivityInfo activityInfo = null;
    //案件配置
    private Map<Integer,LangYaCaseConfig> caseConfigMap = new ConcurrentHashMap<>();
    //案件内选项配置
    private Map<Integer,Map<Integer,LangYaCaseEventConfig>> caseEventConfig = new ConcurrentHashMap<>();
    //各个区域配置
    private Map<Integer,Map<Integer, LangYaBangAreaConfig>> areaConfigMap = new ConcurrentHashMap<>();;
    //建筑总等级配置
    private Map<Integer, LangYaBangBuildingConfig> buildingLevelConfigMap = new ConcurrentHashMap<>();;
    //pve配置
    private Map<Integer, LangYaBangPveConfig> pveConfigMap = new ConcurrentHashMap<>();;
    //求策配置
    private Map<Integer,Map<Integer,LangYaRollDiceConfig>> rollDiceConfigMap = new ConcurrentHashMap<>();;

    private int scoreItemId;                    //积分

    private int energyItemId;                   //体力道具

    private int coinItemId;                     //金币

    private int inspirationItemId;              //灵感

    private int powerSelfId;                    //体力id 不是体力道具 就是体力

    private int caseClueItemId;                 //线索木牌道具id

    private int caseClueCost;                   //断案每次消耗线索

    private int energyMaxNum;                   //体力最大值

    private int energyRecoveryPerTime;          //体力每次恢复数量

    private int energyRecoveryCd;               //体力恢复cd

    private List<Integer> tokenNum;             //宣战令次数（个人次数|商会次数）

    private int tokenId;                        //宣战令id

    private int declareWarBattleEnergyUsed;     //宣战攻击pvp消耗体力

    private int declareWarTokenUsed;            //发起宣战消耗宣战令个数

    private int declareWarAttackAddition;       //宣战进攻加成

    private String declareWarCoinAdd;           //宣战金币加成（根据对手商会排名）

    private List<LangYaValueByRank> declareWarCoinAddList;  //宣战金币加成列表

    private int declareWarUserCoin;             //宣战发起者金币加成（每次进攻被消耗都获得固定收益，配置基础值）

    private List<Integer> openTime;             //开启时间

    private List<NormalWeightItem> npcAttackTimeList;   //PVE攻击NPC次数权重（次数；权重|……

    private List<NormalWeightItem> npcLossBloodList;    //PVE每次攻击npc掉血千分比权重（千分比；权重|……）

    private int noticNum;                               //公告数量

    private String tokenUserRewardByOther;              //宣战发起者道具收益(每次进攻被消耗都获得道具)

    private int temporaryTokenId;                       //临时宣战令

    private List<Integer> guideDrawId;                  //前几次抽奖结果id

    private int drawMultiplyLimit;                      //解锁倍率功能条件：玩家抽奖达到次数

    private Map<Integer,Integer> drawPowerUseNeedHistoryHighPowerMap;   //求策需要多少最高体力的map   6.0弃用

    private Map<Integer,Integer> drawPowerUseNeedHistoryUsedPowerMap;   //求策需要历史使用多少体力的map      6.0新增

    private long autoNeedPower;                         //自动求策需要的积分 6.0新增

    private int scorePerPower;

    public LangYaBangConfig(ActivityInfo activityInfo,Map<Integer, LangYaCaseConfig> caseConfigMap, Map<Integer, Map<Integer, LangYaCaseEventConfig>> caseEventConfig
            ,Map<String, ActivityConfig> activityConfigMap,Map<Integer,Map<Integer, LangYaBangAreaConfig>> langYaBangAreaConfigMap
    ,Map<Integer, LangYaBangBuildingConfig> langYaBangTotalBuildingConfigMap,Map<Integer, LangYaBangPveConfig> pveConfigMap,Map<Integer,Map<Integer,LangYaRollDiceConfig>> langYaRollDiceConfigMap) {
        this.activityInfo = activityInfo;
        this.caseConfigMap = caseConfigMap;
        this.caseEventConfig = caseEventConfig;
        this.areaConfigMap =langYaBangAreaConfigMap;
        this.buildingLevelConfigMap = langYaBangTotalBuildingConfigMap;
        this.pveConfigMap = pveConfigMap;
        this.rollDiceConfigMap = langYaRollDiceConfigMap;
        this.scoreItemId = activityConfigMap.get("EXCHANGE_SCORE_ITEM_ID").getIntValue();
        this.energyItemId = activityConfigMap.get("LANGYA_ENERGY_ITEM_ID").getIntValue();
        this.coinItemId = activityConfigMap.get("LANGYA_COIN_ITEM_ID").getIntValue();
        this.inspirationItemId = activityConfigMap.get("LANGYA_LINGGAN_ITEM_ID").getIntValue();
        this.caseClueItemId = activityConfigMap.get("LANGYA_CASE_CLUE_ITEM_ID").getIntValue();
        this.caseClueCost = activityConfigMap.get("LANGYA_CASE_COST").getIntValue();
        this.energyMaxNum = activityConfigMap.get("LANGYA_ENERGY_MAX_NUM").getIntValue();
        this.energyRecoveryPerTime = activityConfigMap.get("LANGYA_ENERGY_RECOVERY_NUM").getIntValue();
        this.energyRecoveryCd = activityConfigMap.get("LANGYA_ENERGY_RECOVERY_TIME").getIntValue();
        this.tokenNum = activityConfigMap.get("LANGYA_FIGHT_TOKEN_NUM").getIntListValue("\\|");
        this.powerSelfId = activityConfigMap.get("LANGYA_ENERGY_SELF_ITEM_ID").getIntValue();
        this.tokenId = activityConfigMap.get("LANGYA_FIGHT_TOKEN_ID").getIntValue();
        this.declareWarBattleEnergyUsed =activityConfigMap.get("LANGYA_FIGHT_TOKEN_COST_ENERGY").getIntValue();
        this.declareWarTokenUsed = activityConfigMap.get("LANGYA_FIGHT_TOKEN_COST_OPEN").getIntValue();
        this.declareWarAttackAddition = activityConfigMap.get("LANGYA_FIGHT_TOKEN_EX_ADD").getIntValue();
        this.openTime = activityConfigMap.get("LANGYA_OPEN_TIME_DAY").getIntListValue("\\|");
        this.declareWarCoinAdd = activityConfigMap.get("LANGYA_FIGHT_TOKEN_EX_ADD_COIN_TARGET").getValue();
        this.declareWarUserCoin = activityConfigMap.get("LANGYA_FIGHT_TOKEN_EX_ADD_COIN_MYSELF").getIntValue();
        this.npcAttackTimeList = NormalWeightItem.parseWeightItemList(activityConfigMap.get("LANGYA_NPC_DISCOUNT_NUM_WEIGHT").getValue());
        this.npcLossBloodList = NormalWeightItem.parseWeightItemList(activityConfigMap.get("LANGYA_NPC_DISCOUNT_PERCENT_WEIGHT").getValue());

        this.noticNum = activityConfigMap.get("LANGYA_NOTIC_NUM").getIntValue();
        this.tokenUserRewardByOther = activityConfigMap.get("LANGYA_FIGHT_TOKEN_EX_ADD_REWARD_MYSELF").getValue();
        this.temporaryTokenId = activityConfigMap.get("LANGYA_FIGHT_TIMETOKEN_ID").getIntValue();
        this.guideDrawId = activityConfigMap.get("LANGYA_DRAW_ORDER").getIntListValue("\\|");

        this.declareWarCoinAddList = new ArrayList<>();
        List<String> stringList = StringUtils.stringToStringList(declareWarCoinAdd, "\\|");
        for (String s: stringList){
            List<Integer> list = StringUtils.stringToIntegerList(s, ";");
            LangYaValueByRank valueByRank = new LangYaValueByRank();
            valueByRank.setMinRank(list.get(0));
            valueByRank.setValue(list.get(1));
            declareWarCoinAddList.add(valueByRank);
        }

        this.drawMultiplyLimit = activityConfigMap.get("LANGYA_DRAW_MULTIPLY_LIMIT").getIntValue();

        drawPowerUseNeedHistoryHighPowerMap = new ConcurrentHashMap<>();
        List<String> langyaDrawEnergyMultiply = activityConfigMap.get("LANGYA_DRAW_ENERGY_MULTIPLY").getStringListValue("\\|");
        for (String s:langyaDrawEnergyMultiply){
            List<Integer> integers = StringUtils.stringToIntegerList(s, ";");
            drawPowerUseNeedHistoryHighPowerMap.put(integers.get(0),integers.get(1));
        }

        drawPowerUseNeedHistoryUsedPowerMap = new ConcurrentHashMap<>();
        List<String> draw_energy_multiply_2 = activityConfigMap.get("LANGYA_DRAW_ENERGY_MULTIPLY_2").getStringListValue("\\|");
        for (String s:draw_energy_multiply_2){
            List<Integer> integers = StringUtils.stringToIntegerList(s, ";");
            drawPowerUseNeedHistoryUsedPowerMap.put(integers.get(0),integers.get(1));
        }

        this.autoNeedPower = activityConfigMap.get("LANGYA_ASSISTANT_UNLOCK_LIMIT").getIntValue();


        this.scorePerPower = activityConfigMap.get("LANGYA_SCORE_GET").getIntValue();

    }


    public int getScoreItemId() {
        return scoreItemId;
    }

    public int getEnergyItemId() {
        return energyItemId;
    }

    public int getEnergyMaxNum() {
        return energyMaxNum;
    }

    public int getEnergyRecoveryPerTime() {
        return energyRecoveryPerTime;
    }

    public int getEnergyRecoveryCd() {
        return energyRecoveryCd;
    }

    public Map<Integer, LangYaCaseConfig> getCaseConfigMap() {
        return caseConfigMap;
    }

    public Map<Integer, Map<Integer, LangYaCaseEventConfig>> getCaseEventConfig() {
        return caseEventConfig;
    }

    public Map<Integer, Map<Integer, LangYaBangAreaConfig>> getAreaConfigMap() {
        return areaConfigMap;
    }

    public Map<Integer, LangYaBangBuildingConfig> getBuildingLevelConfigMap() {
        return buildingLevelConfigMap;
    }

    public Map<Integer, LangYaBangPveConfig> getPveConfigMap() {
        return pveConfigMap;
    }

    public Map<Integer, Map<Integer, LangYaRollDiceConfig>> getRollDiceConfigMap() {
        return rollDiceConfigMap;
    }

    public int getCoinItemId() {
        return coinItemId;
    }

    public int getInspirationItemId() {
        return inspirationItemId;
    }

    public int getCaseClueItemId() {
        return caseClueItemId;
    }

    public int getCaseClueCost() {
        return caseClueCost;
    }

    public List<Integer> getTokenNum() {
        return tokenNum;
    }

    public int getPowerSelfId() {
        return powerSelfId;
    }

    public int getTokenId() {
        return tokenId;
    }

    public int getDeclareWarBattleEnergyUsed() {
        return declareWarBattleEnergyUsed;
    }

    public int getDeclareWarTokenUsed() {
        return declareWarTokenUsed;
    }

    public int getDeclareWarAttackAddition() {
        return declareWarAttackAddition;
    }

    public List<Integer> getOpenTime() {
        return openTime;
    }

    public String getDeclareWarCoinAdd() {
        return declareWarCoinAdd;
    }

    public int getDeclareWarUserCoin() {
        return declareWarUserCoin;
    }

    public List<NormalWeightItem> getNpcAttackTimeList() {
        return npcAttackTimeList;
    }

    public List<NormalWeightItem> getNpcLossBloodList() {
        return npcLossBloodList;
    }


    public List<LangYaValueByRank> getDeclareWarCoinAddList() {
        return declareWarCoinAddList;
    }

    public int getNoticNum() {
        return noticNum;
    }

    public String getTokenUserRewardByOther() {
        return tokenUserRewardByOther;
    }

    public int getTemporaryTokenId() {
        return temporaryTokenId;
    }

    public List<Integer> getGuideDrawId() {
        return guideDrawId;
    }

    public int getDrawMultiplyLimit() {
        return drawMultiplyLimit;
    }

    public Map<Integer, Integer> getDrawPowerUseNeedHistoryHighPowerMap() {
        return drawPowerUseNeedHistoryHighPowerMap;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public int getScorePerPower() {
        return scorePerPower;
    }

    public Map<Integer, Integer> getDrawPowerUseNeedHistoryUsedPowerMap() {
        return drawPowerUseNeedHistoryUsedPowerMap;
    }

    public long getAutoNeedPower() {
        return autoNeedPower;
    }
}
